<template>
	<view>
		<image class="fixd_bg" src="https://img.jinghushi.com/images/9/2024/12/KaXX1gTweHxtDH4gIgyGFI481D1xnN.png" mode="widthFix"></image>
		<view class="hb_info">
			<view class="flex_center hb_user">
				<image :src="info.avatar"></image>
				<view class="hb_tit">{{info.nickname}}的红包</view>
			</view>
			<view class="hb_desc">{{info.title}}</view>
			<view class="hb_price" style="margin-top: 30rpx;"><text>{{money}}</text>元</view>
			<view class="hb_price" @click.stop="$navTo('/'+info.jump_url)">已存入多米街收入，去购物 ></view>
		</view>
		<view class="hb_tip">{{info.num}}个红包，已领取{{info.has_num}}/{{info.num}}个，共{{info.has_amount}}/{{info.amount}}元</view>
		<view class="hb_grab">
			<view class="flex_box hb_grab_it" v-for="(item,index) in list">
				<image :src="item.avatar"></image>
				<view class="hb_grab_info">
					<view class="flex_between">
						<view class="clamp">{{item.nickname}}</view>
						<view>{{item.amount}}元</view>
					</view>
					<view class="hb_grab_time">{{item.create_time}}</view>
				</view>
			</view>
		</view>
		<view class="fixed_tit">未领取的红包过期后会发起退款</view>
		<view class="empty_loading">
			<image v-show="isloading" src="/static/business/loading.gif" mode=""></image>
			<text v-show="isempty">没有更多了~</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 1,
				id: 0,
				info: [],
				list: [],
				isloading: false,
				isempty: false,
				page: 0,
				money: 0
			};
		},
		onLoad(options) {
			this.id = options.id;
			this.getInfo();
		},
		onReachBottom() {
			this.getInfo();
		},
		methods: {
			getInfo(){
				this.page++;
				this.isloading = true;
				this.isempty = false;
				this.$axios('redpacket/info','POST','member',{
					id: this.id,
					page: this.page
				}).then(res=>{
					this.isloading = false;
					if(res.data.code == 200){
						this.info = res.data.data.hb_info;
						this.money = res.data.data.money;
						this.list = [...this.list, ...res.data.data.hb_list];
						this.isempty = res.data.data.hb_list.length <= 0;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	background: #ffffff;
	padding-bottom: 120rpx;
}
.fixd_bg{
	position: fixed;
	left: 0;
	top: 0;
	width: 100%;
	height: 100rpx;
}
.hb_info{
	margin-top: 100rpx;
	text-align: center;
	padding: 60rpx 20rpx;
	.hb_user{
		image{
			width: 50rpx;
			height: 50rpx;
			border-radius: 10rpx;
			margin-right: 10rpx;
		}
		.hb_tit{
			font-size: 32rpx;
			font-weight: bold;
		}
	}
	.hb_desc{
		font-size: 26rpx;
		color: #666;
		margin: 20rpx 0;
	}
	.hb_price{
		color: #bea475;
		margin-top: 10rpx;
		text{
			font-size: 70rpx;
			font-weight: bold;
			font-family: cursive;
			margin-right: 6rpx;
		}
	}
}
.hb_tip{
	color: #999;
	border-bottom: 2rpx solid #eee;
	margin: 0 20rpx;
	padding-bottom: 20rpx;
	font-size: 26rpx;
}
.hb_grab{
	padding: 0 20rpx;
	.hb_grab_it{
		margin-top: 30rpx;
		image{
			width: 100rpx;
			height: 100rpx;
			border-radius: 10rpx;
			margin-right: 20rpx;
		}
		.hb_grab_info{
			width: calc(100% - 120rpx);
			border-bottom: 2rpx solid #eee;
			padding-bottom: 40rpx;
			.clamp{
				flex: 1;
				padding-right: 20rpx;
				font-size: 30rpx;
			}
			.hb_grab_time{
				color: #999;
				margin-top: 10rpx;
				font-size: 26rpx;
			}
		}
	}
}
.fixed_tit{
	position: fixed;
    bottom: 50rpx;
    text-align: center;
    left: 0;
    right: 0;
    color: #666;	
	font-size: 26rpx;
}
</style>
